import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DramasVO, DramasForm, DramasQuery, DramasAiCheckVO } from '@/api/content/dramas/types';

/**
 * 查询短剧管理列表
 * @param query
 * @returns {*}
 */

export const listDramas = (query?: DramasQuery): AxiosPromise<DramasVO[]> => {
  return request({
    url: '/content/dramas/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询短剧管理详细
 * @param dramaId
 */
export const getDramas = (dramaId: string | number): AxiosPromise<DramasVO> => {
  return request({
    url: '/content/dramas/' + dramaId,
    method: 'get'
  });
};

/**
 * 新增短剧管理
 * @param data
 */
export const addDramas = (data: DramasForm) => {
  return request({
    url: '/content/dramas',
    method: 'post',
    data: data
  });
};

/**
 * 修改短剧管理
 * @param data
 */
export const updateDramas = (data: DramasForm) => {
  return request({
    url: '/content/dramas',
    method: 'put',
    data: data
  });
};

/**
 * 删除短剧管理
 * @param dramaId
 */
export const delDramas = (dramaId: string | number | Array<string | number>) => {
  return request({
    url: '/content/dramas/' + dramaId,
    method: 'delete'
  });
};

/**
 * 审核短剧管理
 * @param data
 */
export const checkDramas = (data: DramasForm) => {
  return request({
    url: '/content/dramas/authcheck',
    method: 'post',
    data: data
  });
};

/**
 * 查询短剧管理审核详情
 * @param dramaId
 */
export const getDramasAiCheck = (dramaId: string | number): AxiosPromise<DramasAiCheckVO> => {
  return request({
    url: '/content/dramas/authcheck/' + dramaId,
    method: 'get'
  });
};
